﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace QuanLyNhaSach.DataAccessLayer
{
    public class UserDAO
    {
        DataConnection dt_con = new DataConnection();

        public DataTable KiemTraUserName(string username)
        {
            return dt_con.Read(String.Format("ACCOUNT_Exist '{0}'", username));
        }

        public DataTable DangNhap(string name, string pass)
        {
            string cmd = "exec ACCOUNT_Login '{0}','{1}'";
            return dt_con.Read(String.Format(cmd, name, pass));
        }

        public void DangKy(string name, string pass,string type)
        {
            string cmd = "exec ACCOUNT_Insert '{0}','{1}','{2}'";
            dt_con.Write(String.Format(cmd, name, pass,type));
        }

        
    }
}
